<!DOCTYPE html>
 <html>
 <head>
 <meta http-equiv="X-UA-Compatible" content="IE=edge">
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
 <% include("/WEB-INF/view/console/common/css.html"){}	%>
 <% include("/WEB-INF/view/console/common/js.html"){} 	%>
 <title></title>
 </head>
 <body> <nav class="navbar navbar-default navbar-fixed-top site-navbar" >
  <div class="navbar-header">
 <a class="navbar-brand" href="#">商品试吃</a>
 </div>
  </nav>
 <form name="boTasteGoods_form"  id="boTasteGoods_form" class="form-horizontal" style="margin-top: 60px;">
  <div class='form-group'>
   <label class="col-sm-2 control-label">商品</label>
   <div class="col-sm-6">
   <select class="form-control" id="boGoodsId"
           name="boGoodsId" check-type="required">
   </select>
   </div>
  </div>
  <script type="text/javascript">
      $(function($){
          componentSelectInit(
              {
                  ctxPath:'${ctxPath}',
                  tableName:"bo_goods",
                  showValueField:"goods_title",
                  valueField:"goods_id",
                  selectId:"boGoodsId"
              }
              ,function(){
                  $("#boGoodsId").val('${boTasteGoods.boGoodsId!""}')
              });
      });
  </script>
  <div class="form-group" >
   <label class="col-sm-2 control-label">金额</label>
   <div class="col-sm-6">
    <input  type="text"  name="tastePrice" id="tastePrice" class="form-control" check-type="required" value='${boTasteGoods.tastePrice!}' >
   </div>
  </div>
 <div class="form-group" >
 <label class="col-sm-2 control-label">总数量</label>
 <div class="col-sm-6">
 <input  type="text"  name="boTotalNum" id="boTotalNum" class="form-control" check-type="required" value='${boTasteGoods.boTotalNum!}' >
 </div>
  </div>
 <div class="form-group" >
 <label class="col-sm-2 control-label">剩余数量</label>
 <div class="col-sm-6">
 <input  type="text"  name="boRemainNum" id="boRemainNum" class="form-control" check-type="required" value='${boTasteGoods.boRemainNum!}' >
 </div>
  </div>
 <div class="form-group" >
 <label class="col-sm-2 control-label">开始时间</label>
 <div class="col-sm-6">
 <input  type="text" onFocus="WdatePicker({startDate:'%y-%M-01 00:00:00',dateFmt:'yyyy-MM-dd HH:mm:ss',alwaysUseStartDate:true})" name="boStartDate" id="boStartDate" class="form-control" check-type="required" value='${boTasteGoods.boStartDate!,"yyyy-MM-dd HH:mm:ss"}' >
 </div>
  </div>
 <div class="form-group" >
 <label class="col-sm-2 control-label">截止时间</label>
 <div class="col-sm-6">
 <input  type="text" onFocus="WdatePicker({startDate:'%y-%M-01 00:00:00',dateFmt:'yyyy-MM-dd HH:mm:ss',alwaysUseStartDate:true})" name="boEndDate" id="boEndDate" class="form-control" check-type="required" value='${boTasteGoods.boEndDate!,"yyyy-MM-dd HH:mm:ss"}' >
 </div>
  </div>
 <div class="form-group" >
 <label class="col-sm-2 control-label">状态</label>
 <div class="col-sm-6">
 <label><input checked='checked' auto_name='boTasteGoods_boStatus' type="radio"  name="boStatus" value="1"/>是</label>
 <label><input  auto_name='boTasteGoods_boStatus' type="radio"  name="boStatus" value="0"/>否</label>
  
 </div>
  </div>
 	<script type="text/javascript">
       $(function($){
       $('input[auto_name="boTasteGoods_boStatus"]').each(function(){
       if('${boTasteGoods.boStatus!}'==this.value){ 
             $(this).attr('checked','checked');
            }
           });
 	    });
 	</script> 
 
   <input type='hidden' name='boTasteGoodsId' id='boTasteGoodsId' value='${boTasteGoods.boTasteGoodsId!}'><input type='hidden' name='common_token' id='common_token' value='${common_token!}'>
 <div class="form-group" style="margin-bottom: 60px;"></div>
 </form>
 <script type="text/javascript">
 $(function($) {
    /*开启表单验证*/
 	$("#boTasteGoods_form").validation();
 });
 /*保存*/
 function saveZqForm(){
    if ($("#boTasteGoods_form").valid() == false) {
 	    return false;
    }
    var formObject=new Object();
     formObject.boGoodsId=$('#boGoodsId').val()==''?null:$('#boGoodsId').val();
     formObject.tastePrice=$('#tastePrice').val()==''?null:$('#tastePrice').val();
 formObject.boTotalNum=$('#boTotalNum').val()==''?null:$('#boTotalNum').val(); 
 formObject.boRemainNum=$('#boRemainNum').val()==''?null:$('#boRemainNum').val(); 
 formObject.boStartDate=$('#boStartDate').val()==''?null:$('#boStartDate').val(); 
 formObject.boEndDate=$('#boEndDate').val()==''?null:$('#boEndDate').val(); 
 formObject.boStatus=($('input[name="boStatus"]:checked').val()==''?null:$('input[name="boStatus"]:checked').val()); 
 formObject.boTasteGoodsId=$('#boTasteGoodsId').val()==''?null:$('#boTasteGoodsId').val(); 
 
    var formObjectJson = JSON.stringify(formObject);
    $.post("${ctxPath}/console/bo_taste_goods/save",
     {
           formObjectJson :formObjectJson,
 	   table_name :'boTasteGoods',
 	   common_token :$("#common_token").val()
     }, function(data) {
            $.confirm({
                title: '提示',
                content: data.message,
                autoClose: 'cancelAction|3000',
                escapeKey: 'cancelAction',
                buttons: {
                    cancelAction: {
                        text: '确定',
                        action: function () {
                            parent.$("#boTasteGoods").bootstrapTable("refresh");
                            parent.art.dialog.get('id-dialog-boTasteGoods').close();
                        }
                    }
                }
            });
     });
 }
 </script>
 <nav class="navbar navbar-default navbar-fixed-bottom site-navbar" >
 <div class="container" style="padding-top:10px;padding-bottom:10px;">
 <div class="nav navbar-nav navbar-right">
 <a href="#" class="btn btn-success"  onclick='saveZqForm()'>保存 </a>
  </div>
  </div>
  </nav>
 </body>
